/*
*    Phantom v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#pragma once
#include "ssi_data.h"


#include "ssi_functiondecl.h"
#include "ssi_tnode.h"
#include "ssi_variable.h"
#include "ssi_functiondecl.h"
#include "ssi_function.h"

class SSI_SCRIPTDLL_API CDataClass :
	public CData
{
public:
	// This needs to be private, too, and only seen by interpreter or engine
	CDataClass(String& Name, const CDataClass* InheritFrom);
	virtual ~CDataClass(void);

private:
	const CDataClass* cSuper;
	CDataClass(const CDataClass& Other);

public:
	CData* MakeData(void);
	SSI_BOOL DataFromString(const String& sData);
	String GetString(void);
	SSI_BOOL CopyData(CData* Other);
	SSI_INT64 SizeOf(void);
	virtual SSI_INT64 Register(SSI_INT64 NewType);
	virtual void UnRegister();
	SSI_BOOL boolean(void);

	// This will be a pointer, and will only be set
	// when initially created in the DataFactory
	// and destroyed likewise
  FuncTree* MemberFuncs;				// Shared among all objects
	VarTree* MemberVars;					// Shared among all objects for initialization

	VarTree LocMemberVars;				// Specific to this object

	CDataClass* LocSuper;

	CStatus AddFunction(CFunctionDecl aFunc);
	CStatus AddNewVariable(CVariable& aVar);
	//CStatus AddNewVariable(SSI_INT64 Type, const String& Name);

	// Need a:
	//  public data member list pointer
	//  protected data member list pointer
	//  private data member list pointer
	//  public function member list pointer
	//  protected function member list pointer
	//  private function member list pointer

	// OR... 
	// Can have new Class-specific 
	//  structures that include the
	//  member function/data and
	//  the protection... Must be
	//  classes in order to be used 
	//  in lists.

	//  public data member list
	//  protected data member list
	//  private data member list

	//CStatus Evaluate(String& In, CVariable& Ret);
	//CStatus Evaluate(CStatement& aStat);
	virtual CData* operator_equal(CData* InData, OpInfoT* Info = SSI_NULL);
	
	SSI_BOOL SynchronizeData(CEngine* anEng);
	SSI_BOOL IsFunctionCallOK(CFunctionDecl InDecl, SSI_CHAR MaxAccess = ACCESS_PRIVATE);
	SSI_BOOL IsExternalCall;
	// Deprecated
	//virtual CStatus EvalClass(VarItor InVars, VarTree& InTree, CStatement& aStat);
	SSI_BOOL InitClass(void);
	//CStatus GetVariable(CVariable& RetVar, CEngine* anEng, INT32 Prot);
	//CStatus SetVariable(CVariable InVar, CEngine* InEng, INT32 InAccess);
	CEngine* MyEngine;
	CStatus CallFunction(CFunction& aFunc);
	virtual CEngine* CreateFunctionEngine(CStatement& aStat);
};



